<template>
  <div>
    <my-header></my-header>
    <my-cen :list="cenList"></my-cen>
  </div>
</template>

<script>
import MyHeader from './components/header'
import MyCen from './components/cen'
import axios from 'axios'
export default {
  name: 'Myhome',
  components: {
    MyHeader,
    MyCen
  },
  data () {
    return {
      cenList: []
    }
  },
  methods: {
    getMyhomeInfo () {
      axios.get('http://huang.ngrok.xiaomiqiu.cn/api/myhome.json')
        .then(this.getMyhomeSucc).catch(function (error) {
          console.log(error)
        })
    },
    getMyhomeSucc (res) {
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        this.cenList = data.cenList
      }
    }
  },
  mounted () {
    this.getMyhomeInfo()
  },
  activated () {
    this.getMyhomeInfo()
  }
}
</script>

<style>

</style>
